package org.jackysoft.entity;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import org.jackysoft.annotations.Form;
import org.jackysoft.annotations.FormEncType;
import org.jackysoft.entity.AbstractEntity;
import org.jackysoft.entity.Department;
import org.jackysoft.entity.User;
import org.springframework.data.annotation.PersistenceConstructor;

@Entity
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true) 
@Form(id="MaintainabilityForm",label="Maintainability 编辑",enctype=FormEncType.NORMAL)
public class Maintainability extends AbstractEntity {
   
    /**
	 * 
	 */
	private static final long serialVersionUID = -4759202083998334024L;

	private Equipment target;
	private String reason;
	private String remark;
	private double cost;
	private String repairor;
	private User declarer;
	private Department department;
	private Date startDate;
	private Date endDate;
	
	@PersistenceConstructor
	public Maintainability(){
		
	}

	
	@ManyToOne
	public Equipment getTarget() {
		return target;
	}




	public void setTarget(Equipment target) {
		this.target = target;
	}




	public String getReason() {
		return reason;
	}




	public void setReason(String reason) {
		this.reason = reason;
	}




	public String getRemark() {
		return remark;
	}




	public void setRemark(String remark) {
		this.remark = remark;
	}




	public double getCost() {
		return cost;
	}




	public void setCost(double cost) {
		this.cost = cost;
	}




	public String getRepairor() {
		return repairor;
	}




	public void setRepairor(String repairor) {
		this.repairor = repairor;
	}




	



	@ManyToOne
	public User getDeclarer() {
		return declarer;
	}




	public void setDeclarer(User declarer) {
		this.declarer = declarer;
	}

	public Date getStartDate() {
		return startDate;
	}


	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}


	public Date getEndDate() {
		return endDate;
	}


	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}


	@Transient
	public Department getDepartment() {
		return declarer==null?Department.NONE:declarer.getDepartment();
	}


	public void setDepartment(Department department) {
		this.department = department;
	}

}